Skip to content

49/auth#52

Merged
cherman23 merged 1 commit into
mainfrom
49/auth
Oct 15, 2025
Merged

49/auth#52
cherman23 merged 1 commit into
mainfrom
49/auth

Conversation

@cherman23

@cherman23 cherman23 commented Oct 10, 2025

Copy link
Copy Markdown
Collaborator

[Area] - Creates functionality for Auth

Changes

This PR adds functionality for authorization. It uses JWTs to implement sessions stored as cookies in the requests. It adds functionality for the following:

  • Logging in
  • Logging out
  • Creating and refreshing sessions

This PR includes pages to test that a cookie is required by the middleware however the sign up and login frontend need to be implemented.


Checklist

Please go through all items before requesting reviewers:

  • All commits are tagged with the ticket number
  • No linting errors / newline warnings
  • All code follows repository-configured formatting
  • No merge conflicts
  • All checks passing
  • Screenshots included for UI changes
  • Remove non-applicable sections of this template
  • PR assigned to yourself
  • Reviewers requested & Slack ping sent
  • PR linked to the issue (fill in 'Closes #')
  • If design-related, notify the designer in Slack

Closes

Closes #49

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds foundational authentication and session management using JWT cookies, protecting routes and exposing basic auth APIs.

  • Introduces JWT session creation/verification and middleware-based route protection
  • Implements login/logout/me API endpoints backed by Prisma and bcrypt
  • Adds hashedPassword to User model, migration, and seed data

Reviewed Changes

Copilot reviewed 17 out of 18 changed files in this pull request and generated 16 comments.

Show a summary per file
File Description
src/middleware.ts Middleware to enforce auth via JWT cookie on protected routes.
src/lib/schemas/user.schema.ts Adds hashedPassword to user creation schema.
src/lib/schemas/errors.ts Adds AuthorizationError.
src/lib/auth/permissions.ts Basic permission helpers.
src/lib/auth/auth.ts Session create/verify/delete and requireAuth helpers.
src/lib/auth/auth-service.ts Login/logout/current user service functions.
src/app/api/users/[id]/route.ts Aligns route params to [id].
src/app/api/auth/me/route.ts Returns current user from session.
src/app/api/auth/logout/route.ts Logout endpoint.
src/app/api/auth/login/route.ts Login endpoint.
src/app/(web)/dashboard/page.tsx Placeholder dashboard page.
src/app/(web)/(auth)/signup/page.tsx Placeholder signup page.
src/app/(web)/(auth)/login/page.tsx Placeholder login page.
prisma/seed.ts Adds hashedPassword to seed users.
prisma/schema.prisma Adds hashedPassword to User model.
prisma/migrations/.../migration.sql Adds NOT NULL hashedPassword column.
package.json Adds jose/bcrypt and types.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/middleware.ts
Comment thread src/lib/auth/auth-service.ts
Comment thread prisma/seed.ts
Comment thread prisma/seed.ts
Comment thread prisma/seed.ts
Comment thread src/lib/auth/auth.ts
Comment thread src/lib/auth/auth.ts
Comment thread src/lib/auth/auth.ts
Comment thread src/lib/auth/auth.ts
Comment thread src/lib/schemas/user.schema.ts
@cherman23 cherman23 merged commit 308a6d5 into main Oct 15, 2025
2 checks passed
@cherman23 cherman23 deleted the 49/auth branch October 15, 2025 02:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Auth] - Implement Authorization

2 participants